﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="companySupplyRangeEdit.aspx.cs"
    Inherits="PeisongWeb.admin.companySupplyRangeEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register TagName="top" Src="controls/top.ascx" TagPrefix="uc1" %>
<%@ Register TagName="menu" Src="controls/menu.ascx" TagPrefix="uc2" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>商品列表 - 想购网长期采购物流配送系统</title>
    <!--#include file="style.inc"-->

    <script src="/app_common/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">

        $(function() {
            $('#chkSelectedAll').click(function() {
                if ($(this).attr('checked')) {
                    $(':checkbox', $('#admin_list_content')).attr('checked', true);
                } else {
                    $(':checkbox', $('#admin_list_content')).attr('checked', null);
                }
            });

            $(':checkbox').click(function() {
                if ($(this).attr('id') != 'chkSelectedAll') {
                    if ($(this).attr('checked')) {
                        $(this).parent().parent().parent().find('td').addClass('checkRow_alt');
                    } else {
                        $(this).parent().parent().parent().find('td').removeClass('checkRow_alt');
                    }
                }
            });
        });

        function delSelectedConfirm(obj) {
            var k = [];
            $(':checkbox', $('#admin_list_content')).each(function(entryIndex, entry) {
                if ($(entry).attr('checked')) {
                    if($(entry).attr('id') != 'chkSelectedAll')//过滤掉全选按钮
                    k.push($(entry).parent().attr('productId') + '|' + $(entry).parent().attr('businessNature'));
                }
            });
            if (k != 0) {
                $('#hdSelectedProductIds').val(k.join(','));
                return confirm('你确定要添加这' + (k.length) + '项吗?');
            } else {
                alert('无任何可以添加的项.');
                return false;
            }
        }

        function resetSrh() {
            document.getElementById("drp_CategoryRoot").value = "";
            document.getElementById("drp_CategorySub").value = "";
            document.getElementById('txtProductNo').value = "";
            document.getElementById('txtProductName').value = "";
            document.getElementById('ddlProductBus').value = "";
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ext:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:ScriptManager ID="sm1" runat="server">
    </asp:ScriptManager>
    <uc1:top ID="Top1" runat="server" />
    <uc2:menu ID="Menu1" runat="server" />
    <div id="admin-body">
        <h2 class="section-cms">
            <span runat="server" id="span_Company"></span>商品列表
        </h2>
        <span>
            <input type="button" value="返回" onclick='javascript:window.location.href="companySupplyRange.aspx?company=<%=companyId %>";' />
        </span>
        <p>
            &nbsp;</p>
        <ext:Panel ID="Panel1" runat="server" Title="商品供应范围搜索" BodyStyle="padding:5px 5px 0"
            Width="1120" Frame="true" ButtonAlign="Center">
            <Body>
                <div id="admin_edit_content_search" style="width:1120px;">
                    <asp:UpdatePanel runat="server" ID="UpdatePanel1">
                        <Triggers>
                            <asp:PostBackTrigger ControlID="lbtn_Search" />
                        </Triggers>
                        <ContentTemplate>
                            <ul>
                                <li style="width: 155px;">
                                    <label>
                                        大类
                                    </label>
                                    <asp:DropDownList runat="server" ID="drp_CategoryRoot" DataTextField="name" DataValueField="categoryId" AutoPostBack="True" OnSelectedIndexChanged="ddl_CategoryRoot_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </li>
                                <li style="width: 155px;">
                                    <label>
                                        小类
                                    </label>
                                    <asp:DropDownList runat="server" ID="drp_CategorySub" DataTextField="name" DataValueField="categoryId">
                                    </asp:DropDownList>
                                </li>
                                <li style="width:155px;">
                                    <label>商品编号</label>
                                    <asp:TextBox runat="server" ID="txtProductNo" Width="85px"></asp:TextBox>
                                </li>
                                <li style="width:155px;">
                                    <label>商品名称</label>
                                    <asp:TextBox runat="server" ID="txtProductName" Width="85px"></asp:TextBox>
                                </li>
                                <li style="width:155px; margin-right:10px;">
                                    <label>商品等级</label>
                                    <asp:DropDownList runat="server" ID="ddlProductBus" DataTextField="name" DataValueField="xm">
                                    </asp:DropDownList>
                                </li>
                                <li style="width:100px;">
                                    [<asp:LinkButton ID="lbtn_Search" runat="server" Text="搜 索" OnClick="lbtn_Search_Click"></asp:LinkButton>]&nbsp;&nbsp;
                                    [<a href="javascript:void(0);" onclick="">重置</a>]
                                </li>
                            </ul>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </Body>
        </ext:Panel>
        <p>
            &nbsp;</p>
        <div id="admin_list_content" style="width:1120px;">
            <table cellpadding="0" cellspacing="0">
                <tr class="header-row">
                    <th>
                        <input type="checkbox" id="chkSelectedAll" />
                    </th>
                    <th>
                        商品编号
                    </th>
                    <th>
                        商品等级
                    </th>
                    <th>
                        商品名称
                    </th>
                    <th>
                        选用
                    </th>
                </tr>
                <asp:Repeater ID="rpt_list" runat="server" OnItemCommand="rpt_list_ItemCommand">
                    <ItemTemplate>
                        <tr class='<%# Container.ItemIndex%2==0? "row-alt":"alt"  %>'>
                            <td>
                                <asp:CheckBox runat="server" ID="chkSelected" productId='<%# DataBinder.Eval(Container.DataItem,"productId") %>' businessNature='<%# DataBinder.Eval(Container.DataItem,"businessNatureRange") %>' />
                            </td>
                            <td>
                                <%# Eval("productNo")%>
                            </td>
                            <td>
                                <%#DataBinder.Eval(Container.DataItem,"businessNatureName") %>
                            </td>
                            <td>
                                <%# Eval("name")%>
                            </td>
                            <td>
                                <asp:LinkButton ID="lbt_Select" runat="server" CommandName="SelectProduct" CommandArgument='<%#string.Format("{0},{1}",Eval("productId"),Eval("businessNatureRange")) %>' Text="选用">
                                </asp:LinkButton>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
                <tr>
                    <td colspan="7">
                        <asp:Button runat="server" ID="btnDelSelected" Text="添加选择项" OnClientClick="return delSelectedConfirm(this);" OnClick="btnDelSelected_Click" />
                    </td>
                </tr>
            </table>
            <div id="page">
                <webdiyer:AspNetPager ID="AspNetPager1" NumericButtonType="Text" MoreButtonType="Text"
                    OnPageChanged="AspNetPager1_PageChanged" runat="server" AlwaysShow="True" PageSize="20"
                    InvalidPageIndexErrorMessage="无效页码" PageIndexOutOfRangeErrorMessage="页码超出范围"
                    ShowCustomInfoSection="Left" CustomInfoHTML=" 每页%PageSize%条记录 | 总共%RecordCount%条记录 "
                    CustomInfoTextAlign="Left" HorizontalAlign="Right" NextPageText="下一页" FirstPageText="首页"
                    LastPageText="末页" PrevPageText="上一页">
                </webdiyer:AspNetPager>
            </div>
        </div>
    </div>
    <asp:HiddenField runat="server" ID="hdSelectedProductIds" />
    </form>
</body>
</html>
